package models.domain;

import models.data.Notendur;
import models.data.verkefninemenda;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: olgak
 * Date: 9.4.2013
 * Time: 10:36
 * To change this template use File | Settings | File Templates.
 */
public class Students {
    public String nemandi_id;
    public String name;
    public Integer afangi_id;
    public List<Students> students;
    public String hopur;
    public Integer hopur_id;
    public String kennitala;
    public Double einkunn;
    private Integer verkefninemenda_id;

    public Students() {
    }

    public Students(String name, String nemandi_id) {
        this.name = name;
        this.nemandi_id = nemandi_id;
    }

    public Students(String nemandi_id, String name, String hopur) {
        this.nemandi_id = nemandi_id;
        this.name = name;
        this.hopur = hopur;
    }
    public Students(String nemandi_id, String name, String hopur,String kennitala) {
        this.nemandi_id = nemandi_id;
        this.name = name;
        this.hopur = hopur;
        this.kennitala = kennitala;
    }

    public Students(Integer afangi_id, List<Students> students) {
        this.afangi_id = afangi_id;
        this.students = students;
    }
    public Students(Integer afangi_id, Integer hopur_id,List<Students> students) {
        this.afangi_id = afangi_id;
        this.students = students;
        this.hopur_id = hopur_id;
    }


    public static List<Students> createStudentList(List<verkefninemenda> verkefniNemendaListi){
        List<Students> returnList = new ArrayList<Students>();
        for (verkefninemenda nemandi:verkefniNemendaListi){
            String name = Notendur.findUser(nemandi.nemandi_id);
            Students student = new Students(name, nemandi.nemandi_id);
            student.setEinkunn(20.0);
            returnList.add(student);
        }

        return returnList;
    }

    public String getNemandi_id() {
        return nemandi_id;
    }

    public void setNemandi_id(String nemandi_id) {
        this.nemandi_id = nemandi_id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAfangi_id() {
        return afangi_id;
    }

    public void setAfangi_id(Integer afangi_id) {
        this.afangi_id = afangi_id;
    }

    public List<Students> getStudents() {
        return students;
    }

    public void setStudents(List<Students> students) {
        this.students = students;
    }

    public String getHopur() {
        return hopur;
    }

    public void setHopur(String hopur) {
        this.hopur = hopur;
    }

    public Integer getHopur_id() {
        return hopur_id;
    }

    public void setHopur_id(Integer hopur_id) {
        this.hopur_id = hopur_id;
    }

    public String getKennitala() {
        return kennitala;
    }

    public void setKennitala(String kennitala) {
        this.kennitala = kennitala;
    }

    public Double getEinkunn() {
        return einkunn;
    }

    public void setEinkunn(Double einkunn) {
        this.einkunn = einkunn;
    }

    public Integer getVerkefninemenda_id() {
        return verkefninemenda_id;
    }

    public void setVerkefninemenda_id(Integer verkefninemenda_id) {
        this.verkefninemenda_id = verkefninemenda_id;
    }
}
